﻿@using Microsoft.FluentUI.AspNetCore.Components
@implements IDialogContentComponent<SplashScreenContent>

<FluentDialogHeader Visible="false" />
<FluentDialogBody>
    <FluentStack Orientation="Orientation.Vertical" HorizontalAlignment="HorizontalAlignment.Center" Class="my-splash">
        <img class="icon" src="@Content.Logo" />
        <p>@Content.Message</p>
        <h3>
            @Content.Title
        </h3>
        <h3>
            @Content.SubTitle
        </h3>
        <div style="width: 340px;">
            <FluentProgress />
        </div>

        <h3>
            @Content.LoadingText
        </h3>
    </FluentStack>
</FluentDialogBody>
<FluentDialogFooter Visible="false" />

@code {


    [Parameter]
    public SplashScreenContent Content { get; set; } = default!;

    [CascadingParameter]
    public FluentDialog Dialog { get; set; } = default!;

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            // Simulation of loading process
            await Task.Delay(7000);

            // Close the dialog
            await Dialog.CloseAsync();
        }
    }
}